package uy.com.cimarron.its.web.beans.commons;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.AuthorizationException;
import org.apache.shiro.subject.Subject;

public class BasicSecurity extends BasicBean{

	private static final long serialVersionUID = -8713454070449399384L;
	public String ADMIN = "ADMIN";
	public String USER = "USER";
	public String UPDATER = "UPDATER";
	
	
	protected boolean checkPermission(String role) {
		boolean isAllowed = true;
		Subject user = SecurityUtils.getSubject();
		try {
			user.checkPermission(role);
		} catch (AuthorizationException e) {
			isAllowed = false;
		}
		return isAllowed;
	}
}
